<%@ Page Language="C#" MasterPageFile="~/BIMP-Template.master" AutoEventWireup="true" CodeFile="ManageInventory.aspx.cs" Inherits="inventory_ManageInventory" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" Runat="Server">Manage Inventory</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <table style="width: 100%">
        <tr>
            <td style="vertical-align: bottom; width: 100px; height: 25px; background-color: #6699cc;">
                <table style="width: 100%; height: 100%">
                    <tr>
                        <td style="width: 50%">
                Inventory Type
                <asp:DropDownList ID="ddlItemType" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlItemType_SelectedIndexChanged">
                </asp:DropDownList></td>
                        <td style="width: 100px">
                            <asp:Label ID="lblTags" runat="server" Visible="False">Tags</asp:Label><br />
                            <asp:DataGrid ID="DataGrid1" runat="server" CssClass="DataGrid" Visible="False">
                <AlternatingItemStyle CssClass="datagridAltItem" />
                <ItemStyle CssClass="datagridItem" />
                <HeaderStyle CssClass="datagridHeader" />
                                           
                            </asp:DataGrid></td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="width: 50%">
            <asp:DataGrid ID="dgInventory" runat="server" CssClass="DataGrid" AutoGenerateColumns="False" OnEditCommand="dgInventory_EditCommand" OnCancelCommand="dgInventory_CancelCommand" OnUpdateCommand="dgInventory_UpdateCommand">
                <AlternatingItemStyle CssClass="datagridAltItem" />
                <ItemStyle CssClass="datagridItem" />
                <HeaderStyle CssClass="datagridHeader" />
                    <Columns>
                        <asp:EditCommandColumn CancelText="Cancel" EditText="Edit" HeaderText="Edit" UpdateText="Update">
                        </asp:EditCommandColumn>
                        <asp:TemplateColumn HeaderText="UPC">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "upc")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "upc")%>' ID="lblUPC" />
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="# In Stock">
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "instock")  %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="tbInStock" runat="server" Width="77px" Text='<%# DataBinder.Eval(Container.DataItem, "instock")  %>'></asp:TextBox>
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Item Type">
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# RetrieveSpecificType(DataBinder.Eval(Container.DataItem, "specification").ToString()) %> '></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:DropDownList id="ddlSpecification" runat="server" DataSource="<%# PopulateItemTypes() %>" DataTextField="type" DataValueField="type_idx" SelectedValue='<%# DataBinder.Eval(Container.DataItem, "specification").ToString() %>' />
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Price">
                            <ItemTemplate>
                                <asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "lastprice") %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="tbPrice" runat="server" Width="77px" Text='<%# DataBinder.Eval(Container.DataItem, "lastprice") %>'></asp:TextBox>
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Tags">
                            <ItemTemplate>
                                <asp:Label ID="Tags" runat="server" Text='<%# populateTags(DataBinder.Eval(Container.DataItem, "upc").ToString()) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
                    </Columns>
                
                </asp:DataGrid>
        </tr>
    </table>

</asp:Content>

